- /* getstr.cpp by K.Tsuru */
- /****************
- string type
- *****************/
- #if 1 ////iostream version///////////////////////
- #include <iostream>
- using namespace std;
-
- char* GetString(){
- string buff;
- cin >> buff;
- return (char*)buff.c_str(); // needs cast (const char*) --> (char*)
- }
- #else /////ncblock version//////////////////////
-
- #include "getnum.h"
- #include "ncblock.h"
-
- static NCBlock <char> buff;
- char* GetString(){
- int c;
- uint len = 0;
- buff.size(4, -1);
- while(1){
- c = getchar();
- buff.reserve(len);
- if(c == '\n'){
- buff[len] = '\0';
- break;
- }
- buff[len++] = (char)(c & 0xff);
- }
- return buff.Elements();
- }
- #endif
getstr.cpp : last modifiled at 2017/05/24 11:20:49(679 bytes)
created at 2016/04/11 11:17:20
The creation time of this html file is 2017/10/07 10:54:15 (Sat Oct 07 10:54:15 2017).